<?php
$line = array('ID','ComID','Date','Company','Code','Director','Transaction','Number','Price','Value','Holding');
$csv->addRow($line);
foreach ($codtrans as $codtrans):
    
	$line = array($codtrans['Codtran']['id'],
	$codtrans['Codtran']['ComID'],
	$codtrans['Codtran']['Date'],
	$codtrans['Codtran']['Company'],
	$codtrans['Codtran']['Code'],
	$codtrans['Codtran']['Director'],
	$codtrans['Codtran']['Transaction'],
	$codtrans['Codtran']['Number'],
	$codtrans['Codtran']['Price'],
	$codtrans['Codtran']['Value'],
	$codtrans['Codtran']['Holding']        
	);
	$csv->addRow($line);
        endforeach;
echo $csv->render('codtrans.csv');
?>